//
//  MateTypeCollectionViewCell.m
//  TQY
//
//  Created by 甘世清 on 2024/9/30.
//

#import "MateTypeCollectionViewCell.h"

@implementation MateTypeCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        self.contentView.backgroundColor = UIColor.clearColor;
        self.contentView.layer.cornerRadius = 6;
        self.contentView.layer.masksToBounds = YES;
        [self.contentView addSubview:self.nameLabel];
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make){
            make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(5, 0, 5, 0));
        }];
    }
    return self;
}
- (void)setModel:(MateTypeModel *)model{
    _model = model;
    self.nameLabel.text = model.string;
    if (model.isSeleted) {
        self.nameLabel.textColor = UIColor.whiteColor;
        self.nameLabel.backgroundColor = SQColor3DA59D ;
    } else {
        self.nameLabel.textColor = SQColor333333;
        self.nameLabel.backgroundColor =  UIColor.whiteColor;
    }
}

-(UILabel*)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.font = FONT_MEDIUM(14);
        _nameLabel.textAlignment = NSTextAlignmentCenter;
        _nameLabel.textColor = SQColor333333;
        _nameLabel.numberOfLines = 0;
        _nameLabel.layer.cornerRadius = 15;
        _nameLabel.layer.masksToBounds = YES;
        _nameLabel.backgroundColor =  SQColorF5F5F5;
    }
    return _nameLabel;
}

@end
